<template>
  <div>
    <span v-for="item in arr" :key="item"><input type="checkbox" v-model="p" :value="item" />{{ item }}</span
    ><br />
    你选中的元素积累的和为<span>{{ sum }}</span>
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {},
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      p: [],
    }
  },
  computed: {
    sum() {
      return this.p.reduce((sum, item) => {
        return (sum += item)
      }, 0)
    },
  },
  watch: {},
  created() {},
  methods: {},
}
</script>

<style scoped></style>
